<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>题库列表</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <script src="/bootstrap/js/jquery.min.js"></script>
    <script src="/bootstrap/js/bootstrap.min.js"></script>
    <script>
        function gotoPage(p){
            location.href="page?currtPage="+p;
        }
    </script>
</head>
<body>
<div class="container">
    <div class="panel panel-success">
        <div class="panel-heading panel-title text-center">
            <h1>题库列表</h1>
        </div>
        <div class="panel-body">

            <form action="/repocontroller/page" class="form-horizontal form-inline">
                <input type="text" class="form-control" name="name" value="${param.name}" placeholder="请输入题库名" maxlength="20"/>
                <button type="submit" class="btn btn-primary glyphicon glyphicon-search" >搜索</button>
            </form>

            <table class="table table-hover table-bordered table-striped table-condensed">
                <thead>
                <tr>
                    <td>ID</td>
                    <td>题库名称</td>
                    <td>创建者id</td>
                    <td>创建时间</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="u">
                    <tr>
                        <td>${u.id}</td>
                        <td>${u.name}</td>
                        <td>${u.userId}</td>
                        <td>${u.createTime}</td>
                        <td>
                            <a href="javascript:updateRepo(${u.id})">修改</a >
                            <a href="javascript:inRepo(${u.id})">进入题库</a >
                        </td>
                    </tr>
                </c:forEach>
                <tr>
                    <td colspan="8" class="text-center">
                        <ul class="pagination ">
                            <c:if test="${page.totalCount>0}">
                                总${page.totalCount}条  每页${page.pageLimit}条
                                <a href="${pageContext.request.contextPath}/${page.url}?currtPage=${page.currtPage-1}${page.params}">上一页</a>  <a href="${pageContext.request.contextPath}/${page.url}?currtPage=${page.currtPage+1}${page.params}">下一页</a>
                            </c:if>
                            <c:if test="${page.totalCount<=0}">
                                对不起，暂无数据
                            </c:if>

                        </ul>
                    </td>
                </tr>
                </tbody>

            </table>

        </div>

    </div>
</div>
</body>
<script>
    function updateRepo(id) {
        location.href="/repocontroller/"+id;
    }
    function inRepo(id) {
        location.href="/questController/"+id;
    }
</script>
</html>
